package com.woniuxy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.entity.SettleAccount;
import com.woniuxy.service.SettleAccountService;
import com.woniuxy.utils.Result;

@Controller
@RequestMapping("/settleaccount")
public class SettleAccountController {
	@Autowired
	private SettleAccountService settleAccountService;
	@RequestMapping("/all")
	@ResponseBody
	public Result<List<SettleAccount>> all(){
		Result<List<SettleAccount>> result = new Result<>();
		result.setData(settleAccountService.all());
		return result;
		
	}
	@RequestMapping("/add")
	@ResponseBody
	public Result<List<SettleAccount>> addSettleAccount(SettleAccount settleAccount,int paid){
		Result<List<SettleAccount>> result = new Result<>();
		if(settleAccountService.addSettleAccount(settleAccount, paid)==1){
			result.setStatus(Result.SUCCESS);
			result.setMessage("ok");
			
		}else{
			result.setStatus(Result.ERROR);
			result.setMessage("no");
			
		}
		return result;
		
	}
	
}
